﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using WebApplication1.Business;

namespace WebApplication1
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            UserBusiness us = new UserBusiness();
            bool flag = us.CheckCreat(txtUser.Text);
            if (flag)
            {
                showMessage("UserID existed !");
            }
            else {
                string date = cbDate.SelectedItem.ToString() + "/" + cbMonth.SelectedItem.ToString() + "/" + cbYear.SelectedItem.ToString();
                bool gend=true;
                if (RadioButton2.Checked)
                {
                    gend = false;    
                }
                us.CreatAcc(txtUser.Text, txtPass.Text, txtFName.Text, txtLName.Text, date , gend, Int32.Parse(txtPhone.Text), txtAddress.Text, txtEmail.Text);
                Response.Redirect("Homes.aspx");
            }
        }

        public void showMessage(string mess)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "alert", "<script language='javascript'>alert('" + mess + "')</script>", false);
        }
    }
}
